package com.xy.p2p.service.impl;


import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import com.xy.core.util.BeanUtil;
import com.xy.p2p.dao.TimageinfoDao;
import com.xy.p2p.model.Timageinfo;
import com.xy.p2p.service.TimageinfoService;

@Service
@Transactional
public class TimageinfoServiceImpl extends BaseServiceImpl<Timageinfo> implements
		TimageinfoService {
	private TimageinfoDao timageinfoDao;

	public TimageinfoServiceImpl(TimageinfoDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.timageinfoDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return timageinfoDao.checkExist("Timageinfo", paraName, paraValue);
	}

	@Override
	public List<Timageinfo> getTimageinfo(Map<String, Object> map) {
		return timageinfoDao.getTimageinfo(map);
	}
	@Override
	public Pagination getTimageinfoByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return timageinfoDao.getTimageinfoByPage(map, pageNo, pageSize);
	}
	 
	@Override
	public Timageinfo save(Timageinfo timageinfo) {
	//	timageinfo.setModtime(new Date());
		if(timageinfo.getTiid()==null){
			//新增
        	return super.save(timageinfo);
		}else{
			//更新
			Timageinfo timageinfo1=timageinfoDao.get(timageinfo.getTiid());
			try {
				BeanUtil.copyNotNullProperties(timageinfo1, timageinfo);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(timageinfo1);
		}
	}
}